<?php

namespace app\admin\model\money;

use app\admin\model\Communitys;
use app\admin\model\department\Lists;
use think\Model;


class Change extends Model
{

    

    

    // 表名
    protected $name = 'money_change';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'status_text'
    ];
    

    
    public function getStatusList()
    {
        return ['1) unsigne' => __('1) unsigne')];
    }


    public function getStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['status']) ? $data['status'] : '');
        $list = $this->getStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function lists()
    {
        return $this->belongsTo('app\admin\model\product\Lists', 'product_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function communitys()
    {
        return $this->belongsTo(Communitys::class, 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function dlists()
    {
        return $this->belongsTo(Lists::class, 'targetuserid', 'id', [], 'LEFT')->setEagerlyType(0);
    }

}
